<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>小包发票</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link href="cxcalendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar-new.js"></script>
<script type="text/javascript">
function import_express(){
    window.parent.iframe_form("importexpress", '上传导入文件', '<{$config.weburl}>/admin/module.php?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&act=importexpress', 300,300);
    return false;
}
</script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>小包发票</h3>
            <ul>
                <li <{if $smarty.get.act=='createPdf'}><{else}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>"><span>管理</span></a></li>
                <li <{if $smarty.get.act=='createPdf'}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&act=createPdf"><span>生成</span></a></li>
			</ul>
			<ul style="float:right;">
                <li><a href="javascript:make_package(<{$packageError}>,'tip');"><span>打包小票</span></a></li>
			</ul>
			<ul style="float:right;">
                <li><a href="javascript:make_package(<{$spsPackageError}>,'sps');"><span>打包sps运单</span></a></li>
			</ul>
        </div>
    </div>
    <div class="h35"></div>
    
    <{if $smarty.get.act=='createPdf'}>
    <table class="select_table">
        <tr>    
            <td>
                <div class="select_box">
                方式一:<a href="javascript:;" onclick="import_express();"><span>导入表格生成</span></a>
                
                <form action="" method="post">
                方式二:
                <input type="hidden" value="createPdf" name="act"/>
                    <table>
                        <tr><td><textarea placeholder="请输入订单编号..." name="order_ids" cols="50" rows="20"></textarea></td><td><span style="color:red;">订单号间请用英文逗号隔开</span></td></tr>
                        <tr>
                        	<td colspan="2">
                        		<input type="submit" name='op' value="生成小票" />
                        		<input type="submit" name='op' value="生成sps运单" />
                        	</td>
                       	</tr>
                    </table>
                </form>
                </div>
           </td>
        </tr>
    </table>
    <{else}>
    <form action="" method="get">
    <input type="hidden" name="m" value="<{$smarty.get.m}>">
    <input type="hidden" name="s" value="<{$smarty.get.s}>">
    <table>
        <tr>    
           <td>
               	<span>&nbsp;小票类型：</span>
				<select name="file_type">
					<option value="all">全部</option>
					<option value="tip" <{if $smarty.get.file_type=='tip'}>selected<{/if}>>发票</option>
					<option value="sps" <{if $smarty.get.file_type=='sps'}>selected<{/if}>>sps运单</option>
				</select>
           </td>
           <td>
                    <span>&nbsp;打包时间：</span>
                    <span>
                            <input class="w120 input_cxcalendar" type="text" name="p_stime" id="p_stime" value="<{$smarty.get.p_stime}>"">
                            -
                            <input class="w120 input_cxcalendar" type="text" name="p_etime" id="p_etime" value="<{$smarty.get.p_etime}>"">
                    </span>
           </td>
           <td>
                <input type="submit" value="搜索" />
           </td>
        </tr>
    </table>
    </form>
    
    <table class="table product">
       <tbody>
       <tr class="header">
            <th width="200">文件名</th>
            <th width="150">类型</th>
            <th width="150">创建时间</th>
            <th width="80">操作</th>
        </tr>
        <{foreach item=val from=$list}>
        <tr>
        	<td><{$val.name}></td>
        	<td><{$val.type}></td>
            <td><{$val.create_time|date_format:"%Y-%m-%d&nbsp;%H:%M:%S"}></td>
            <td><a href="<{$val.link}>">下载</a></td>
        </tr>
        <{foreachelse}>
        <tr>
            <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
        </tr>
        <{/foreach}>
		</tbody>
    </table>
    <{/if}>
<script>
$(function(){
	//时间搜索
	$('.input_cxcalendar').each(function(){
	    var a = new Calendar({
	        targetCls: $(this),
	        type: 'yyyy-mm-dd HH:MM:SS',
	        wday:2
	    },function(val){
	        console.log(val);
	    });
	});
});
function make_package(isError,type)
{
	if(isError){
		alert('没有可打包文件');return false;
	}
	window.location.href = '?m=product&s=sps_bill.php&act=package&type='+type;
}
</script>
</div>
</body>
</html>